Ext.define('eView.view.eview.MainList', {
	extend: 'Ext.grid.Panel',
	alias: 'widget.mainlist',
	width: '100%',
    title: 'eViews',  
    multiSelect: true,
    clicksToEdit: 2,
	selModel: {
		    pruneRemoved: false
	},
	 
	viewConfig: {
	    forceFit: false,
		trackOver: false,
	    emptyText: '<h1 style="margin:20px">No results found</h1>'
	  },
	 
	
	initComponent: function() {    
	
		this.features = [{
			ftype: 'filters',
			encode: true, // json encode the filter query
			local: false, 
			filters: [{
				type: 'string',
				dataIndex: 'THENAME'
			}]
		}];
	 
	    this.plugins = [
			Ext.create('Ext.grid.plugin.CellEditing', {
			    clicksToEdit: 2
    	    })
			
		];
		this.store = 'eview.mainListStore';
		this.bbar = Ext.create('Ext.toolbar.Paging', {
				        store: 'eview.mainListStore', 
				        displayInfo: true,
				        emptyMsg: "No topics to display"
				   });
		this.tbar = [{
			xtype: 'displayfield',
			name: 'imagedisplay',
	   		value: '',
	   		height: 60,
	   		width: 300
		  },{
		  	text: 'Open',
			action: 'openeview'
		  },{
			text: 'Add',
			action: 'addeview'
		  },{
		  	text: 'Edit',
			action: 'editeview'
		  },{
		  	text: 'Delete',
			action: 'deleteeview'
		  },{
		  	text: 'Share',
			action: 'shareeview'
		  }];
		  
		this.columns =  [{
            xtype: 'rownumberer',
            width: 50,
            sortable: false
	       },{  
		    text: 'eView Code',  
		    dataIndex: 'EVIEWCODE',
			hidden: true,
		    width: 50
		  },{  
		    text: 'Company Code',
		    dataIndex: 'COMPANYCODE',
			hidden: true,
		    width: 50
		  },{
		    text: 'Group',
		    dataIndex: 'THEGROUP',
			filterable: true,
		    flex: 1
		  },{
		  	text: 'Name',
			dataIndex: 'THENAME',
			filterable: true,
			maxLength: 5,
			editor: 'textfield',
			renderer: function(value,p,record) {return Ext.String.format('<a class=\'aaa{0}zzz\'href=\'##\'><b>{0}</b></a>', value)},
			flex: 1
		  },{
		  	text: 'Type',
			dataIndex: 'THETYPE',
			filterable: true,
			editor: 'textfield',
			flex: .5
		  },{
		    text: 'Date Created',
		    dataIndex: 'RECDATECREATED',
			hidden: true,
			width: 150
		  },{
		    text: 'Date Modified',
		    dataIndex: 'DATELASTUPDATE',
			hidden: true,
			width: 150
		  }];

		this.callParent(arguments);
	}
})
